package com.tianyue.overlordgame.ui.commonmodel;

import android.app.Application;
import android.databinding.ObservableBoolean;
import android.databinding.ObservableField;
import android.support.annotation.NonNull;

import com.tianyue.overlordgame.config.CommonTags;

import me.goldze.mvvmhabit.base.BaseViewModel;

public class CommonSIMCodeViewModel extends BaseViewModel {
    public CommonSIMCodeViewModel(@NonNull Application application) {
        super(application);
    }

    //手机号
    public ObservableField<String> phone_num_text = new ObservableField<>("");

    //验证码
    public ObservableField<String> sim_code_text = new ObservableField<>("");
    //注册获取验证码按钮文字
    public ObservableField<String> sendCodeText = new ObservableField<>("发送验证码");
    //注册获取验证码按钮是否可点击
    public ObservableBoolean isGetCodeClick = new ObservableBoolean(true);

    public UIChangeObser uc = new UIChangeObser();

    public class UIChangeObser {
        public ObservableBoolean loginCountDown = new ObservableBoolean(false);
        public ObservableBoolean registerCountDown = new ObservableBoolean(false);
        public ObservableBoolean forgetPasswordCountDown = new ObservableBoolean(false);
    }

    /**
     * 获取验证码
     *
     * @param i
     */
    protected void requestSmsCode(int sim_code_type) {
        //...TODO
        //...if success
        switch (sim_code_type) {
            case CommonTags.SIM_CODE_LOGIN://登录
                uc.loginCountDown.set(!uc.loginCountDown.get());
                break;
            case CommonTags.SIM_CODE_REGISTER://注册

                break;
            case CommonTags.SIM_CODE_FORGET://忘记密码

                break;
        }
    }
}
